﻿using HamcoWcs.Entitys.Bases;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;

namespace HamcoWcs.Entitys.Logss
{
    /// <summary>
    /// 心跳日志
    /// </summary>
    public class HeartBeatLog : BaseEntity, IEntityTypeConfiguration<HeartBeatLog>
    {
        /// <summary>
        /// 心跳标识
        /// </summary>
        public string TID { get; set; }
        /// <summary>
        /// 心跳对象
        /// </summary>
        public EnumHBTarget HBTarget { get; set; }
        /// <summary>
        /// 心跳类型（false:收|true:发）
        /// </summary>
        public bool HBType { get; set; }
        /// <summary>
        /// 是否确认
        /// </summary>
        public bool ACK { get; set; }
        /// <summary>
        /// 心跳时间
        /// </summary>
        public DateTime HBTime { get; set; }
        public void Configure(EntityTypeBuilder<HeartBeatLog> builder)
        {
            builder.HasComment("心跳日志");
            builder.Property(x => x.TID).IsRequired().HasMaxLength(40).HasComment("心跳标识");
            builder.Property(x => x.HBTarget).IsRequired().HasComment("心跳对象");
            builder.Property(x => x.HBType).HasComment("心跳类型（收|发）");
            builder.Property(x => x.ACK).HasMaxLength(50).HasComment("是否确认");
            builder.Property(x => x.HBTime).HasComment("心跳时间");
        }
    }

    /// <summary>
    /// 心跳对象
    /// </summary>
    public enum EnumHBTarget
    {
        /// <summary>
        /// 其他服务
        /// </summary>
        SERVICE,
        MES,
        WMS,
        CV,
        SRM,
        RGV,
        LFT,
        TARM,
        OHT,
        OHB,
    }
}
